package com.guo.utils;

import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class WebUtils {

    /**
     * 将字符串渲染到客户端
     * @param response 渲染对象
     * @param string 待渲染字符串
     * @return
     */
    public static String renderString(HttpServletResponse response, String string){

        response.setStatus(200);
        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        try {
            response.getWriter().print(string);
        } catch (IOException e) {
            e.getStackTrace();
        }
        return null;
    }
}
